package com.qianli.cashmama.trade.common.error;

import com.fqgj.exception.enums.MsgCodeEnum;
import com.qianli.cashmama.trade.common.utils.MessageManager;

/**
 * Created with IntelliJ IDEA.
 * User: sm
 * Date: 2017/7/25
 * Time: 下午2:35
 * <p>
 * 交易的错误码从70000开始
 *
 * @author zsp
 */
public enum TradeErrorCodeEnum implements MsgCodeEnum {
    /**
     *
     */
    default_error(9999, MessageManager.getMsg("default_error")),
    create_failed(70001, MessageManager.getMsg("create_failed")),
    trade_not_exist(70002, MessageManager.getMsg("trade_not_exist")),
    trade_closed_already(70003, MessageManager.getMsg("trade_closed_already")),
    trade_re_loan_failed(70004, MessageManager.getMsg("trade_re_loan_failed")),
    trade_status_transfer_error(70005, MessageManager.getMsg("trade_status_transfer_error")),
    close_trade_failed(70006, MessageManager.getMsg("close_trade_failed")),
    fetch_user_snapshot_failed(70007, MessageManager.getMsg("fetch_user_snapshot_failed")),
    user_code_check_failed(70008, MessageManager.getMsg("userCode_can_not_be_empty")),
    trade_status_check_error(70009, MessageManager.getMsg("trade_status_check_error")),

    bill_not_exist(70011, MessageManager.getMsg("bill_not_exist")),
    bill_paid_already(70021, MessageManager.getMsg("bill_paid_already")),
    bill_paid_failed(70022, MessageManager.getMsg("bill_paid_failed")),
    bill_closed_failed(70023, MessageManager.getMsg("bill_closed_failed")),
    bill_list_compose_failed(70024, MessageManager.getMsg("bill_compose_failed")),
    bill_compose_failed(70025, MessageManager.getMsg("bill_compose_failed")),

    offer_detail_failed(70031, MessageManager.getMsg("offer_detail_failed")),
    bill_detail_compose_failed(70041, MessageManager.getMsg("bill_detail_compose_failed")),
    push_to_loan_failed(70051, MessageManager.getMsg("push_to_loan_failed")),
    risk_info_not_exist(70061, MessageManager.getMsg("risk_info_not_exist")),
    push_to_service_fee_failed(70071, MessageManager.getMsg("push_to_service_fee_failed")),

    product_not_exist(70071, MessageManager.getMsg("product_not_exist")),
    push_to_kb_param_error(70072, "push_to_kb_param_error"),
    operation_not_allowed(70073, "operation_not_allowed");

    private int code;
    private String msg;

    TradeErrorCodeEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }


    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getMsg() {
        return msg;
    }

    public TradeErrorCodeEnum setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public TradeErrorCodeEnum setCode(int code) {
        this.code = code;
        return this;
    }
}
